
export const searchForm = [
    {
        type: 'select',
        key: 'department',
        label: '学部',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'area',
        label: '中心',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'grade',
        label: '年级',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'subjectId',
        label: '学科',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
];

// 页面id
export const pageId = {
    0: {
        id: 'GroupLeaderReport_select',
        title: '大小组看板',
        selectID: 'GroupLeaderReport_select'
    },
};

export const toLine = name => (name ? name.replace(/([A-Z])/g, '_$1').toLowerCase() : '');

// 纬度id由页面id 和 纬度key拼接
export const getDimensionId = (index, searchKey) => {
    if (searchKey) {
        return `${pageId[index].id}_${toLine(searchKey)}`;
    }
    return '';
};

export const initialValues = {
    department: ['全部'],
    area: ['全部'],
    subjectId: ['全部'],
    grade: ['全部']
};

export const getDefaultDimension = () => {
    const dimension = [];
    for (const i in initialValues) {
        dimension.push({
            dimensionId: getDimensionId(0, i),
            dimensionName: toLine(i),
            value: initialValues[i]
        });
    }
    return dimension;
};

export const initRank = 'total_renewal_num_sum';
export const rankSelectConfig = [
    {
        value: initRank,
        label: '综合续班率'
    },
    {
        value: 'renewal_num_sum',
        label: '纯续班率'
    }
];
